import java.text.ParseException;
import java.util.Scanner;


public class warn {
    private static String username="admin";
    private static String userzhang="123456";
    public static void check(String zhang, String sec){
        if(zhang.equals(userzhang)){
             throw new UserNameException("用户有问题");
        }
        if (sec.equals(username)){
            throw new PasswordException("密码有问题");
        }
    }
    public static void main(String[] args) {
        try {
            System.out.println("请输入账号");
            Scanner scanner = new Scanner(System.in);
            String zhang = scanner.toString();
            System.out.println("请输入密码");
            String sec = scanner.toString();
            check(zhang,sec);
        }catch (PasswordException){
            System.out.println("PasswordException来解决");
        }catch(UserNameException){
            System.out.println("UserNameException来解决");
        }
    }
    class UserNameException extends RuntimeException{
        public UserNameException(String hihi){
            super(hihi);
        }
    }
     class PasswordException extends RuntimeException{
        public PasswordException(String message){
            super(message);
        }
    }
}
